package com.liycloud.mall.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liycloud.mall.api.entity.OrderEntity;
import com.liycloud.mall.order.mapper.OrderMapper;
import com.liycloud.mall.order.service.OrderService;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 *  Order 订单主表
 *
 **/
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> implements OrderService {

	/**
	 *  通过用户ID  查询该用户所有订单order
	 */
	@Override
	public List<OrderEntity> getOrderByUserId(Integer userId) {
		return baseMapper.selectList(new Wrapper<OrderEntity>() {
			@Override
			public OrderEntity getEntity() {
				OrderEntity orderEntity = new OrderEntity();
				orderEntity.setUserId(userId);
				return orderEntity;
			}

			@Override
			public MergeSegments getExpression() {
				return null;
			}

			@Override
			public void clear() {

			}

			@Override
			public String getSqlSegment() {
				return null;
			}
		});
	}
}
